<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:p='http://primefaces.org/ui'
      xmlns:h='http://java.sun.com/jsf/html'
      xmlns:cc='http://java.sun.com/jsf/composite'>

<cc:interface>

<cc:attribute name='id'/>

<cc:attribute name='b'/>

<cc:attribute name='t'/>

<cc:attribute name='v'/>

<cc:attribute name='wT' default='65'/>

<cc:attribute name='w1'  default='50px'/>

<cc:attribute name='w2'  default='170px'/>

<cc:attribute name='var' default='x'/>

<cc:attribute name='xL' default='#{cc.attrs.x.nombre}'/>

<cc:attribute name='x'/>

<cc:attribute name='style'/>

<cc:attribute name='u' default='@(.#{cc.attrs.b.name})'/>

<cc:attribute name='p' default='@(.#{cc.attrs.b.name})'/>

<cc:attribute name='onkeydown'/>

</cc:interface>


<cc:implementation>

<h:panelGrid columns='5' cellpadding='0' cellspacing='0' styleClass='align-bottom'>

  <h:panelGrid columns='1' cellpadding='0' cellspacing='0' width='#{cc.attrs.wT}' styleClass='ui-state-default xFd'><span>#{cc.attrs.t}</span></h:panelGrid>

  <h:panelGroup id='valueId'>

  <p:inputText id='input' value="#{cc.attrs.b['XMaterialCod']}" styleClass='xIn' style='margin-right: 3px; width: #{cc.attrs.w1}' onkeypress='if(event.keyCode == 13) { materialFind(); return false }'/>

  </h:panelGroup>


  <p:autoComplete id='completeMaterial' value='#{cc.attrs.v}' completeMethod="#{cc.attrs.b['XMaterialComplete']}" converter="#{cc.attrs.b['XMaterialConverter']}" onkeydown='#{cc.attrs.onkeydown}'

                    var='#{cc.attrs.var}' itemLabel='#{cc.attrs.xL}' itemValue='#{cc.attrs.x}'

                    styleClass='xAuto' rendered='#{!cc.attrs.read and cc.attrs.cp == null  and cc.attrs.cv == null}' style='width: #{cc.attrs.w2}; #{cc.attrs.style}'>

  <p:ajax event='itemSelect' listener="#{cc.attrs.b['XMaterialSelect']}" update='#{cc.attrs.u}' process='#{cc.attrs.p}' partialSubmit='true'/>

  <p:column>

  <p:graphicImage title='#{cc.attrs.x.codigo}' value='http://#{facesContext.externalContext.requestServerName}/savanti/material/#{cc.attrs.x.id}.png' width='40' height='30'/>

  <h:outputText style='margin-left: 5px; vertical-align: top'  value='#{cc.attrs.x.nombre}'/>

  </p:column>

  </p:autoComplete>


  <p:commandButton icon='ui-icon-check' title='Buscar' styleClass='rmvCorner'  style='border-top: none;border-right: none;width: 22px;height: 16px' actionListener="#{cc.attrs.b['XMaterialFind']}" update='#{cc.attrs.u}' process='#{cc.attrs.p}' partialSubmit='true'/>

  <p:remoteCommand name='materialFind' actionListener="#{cc.attrs.b['XMaterialFind']}" update='#{cc.attrs.u}' process='#{cc.attrs.p}' partialSubmit='true'/>

</h:panelGrid>

</cc:implementation>

</html>